<template>
  <div class="shop-info">
    <div class="shop-logo">
      <img :src="shops.logo">
      <span>{{shops.name}}</span>
    </div>
    <div class="shop-count">
      <div class="shop-left">
        <div class="shop-sells">
          <span class="shop-sells-count">{{shops.sells | sellCountFilter}}万</span>
          <span class="shop-sales-title">总销量</span>
        </div>
        <div class="shop-goods">
          <span class="shop-goods-count">{{shops.goodsCount}}</span>
          <span class="shop-goods-title">全部宝贝</span>
        </div>
      </div>
      <div class="shopbro"></div>
      <div class="shop-right">
        <table>
          <tr v-for="(item, index) in shops.score" :key="index" class="shop-scroe">
            <td>{{item.name}}</td>
            <td class="right-score" :class="{'score-better' : item.isBetter}">{{item.score}}</td>
            <td class="right-isBetter" :class="{'better-more' : item.isBetter}">{{item.isBetter ? '高' : '低'}}</td>
          </tr>
        </table>
      </div>
    </div>
    <div class="shop-bottom">
      <div class="enter-bottom">进店逛逛</div>
    </div>
  </div>
</template>

<script>
  //这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
  //例如：import 《组件名称》 from '《组件路径》';

  export default {
    //import引入的组件需要注入到对象中才能使用
    components: {},
    props: {
      shops:{
        type: Object,
        default(){
          return {}
        }
      }
    },
    data() {
    //这里存放数据
      return {
      };
    },
    //过滤器
    filters:{
      sellCountFilter(value){
        if (value<1000){
          return value;
        }else{
          return (value/10000).toFixed(1);
        }
      }
    },
    //计算属性 类似于data概念
    computed: {
    },
    //监控data中的数据变化
    watch: {},
    //方法集合
    methods: {

    },
    //生命周期 - 创建完成（可以访问当前this实例）
    created() {

    },
    //生命周期 - 挂载完成（可以访问DOM元素）
    mounted() {

    },
    beforeCreate() {}, //生命周期 - 创建之前
    beforeMount() {}, //生命周期 - 挂载之前
    beforeUpdate() {}, //生命周期 - 更新之前
    updated() {}, //生命周期 - 更新之后
    beforeDestroy() {}, //生命周期 - 销毁之前
    destroyed() {}, //生命周期 - 销毁完成
    activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
  }
</script>
<style scoped>
.shop-info{
  margin: 0 0.3125rem;
}
.shop-logo{
  height: 4.375rem;
  width: 100%;
  line-height: 4.375rem;
}
.shop-logo img{
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 2.5rem;
  vertical-align: middle;
}
.shop-count{
  display: flex;
}
.shop-left{
  width: 50%;
  display: flex;
  margin-top: 0.5rem;
}
.shop-sells,.shop-goods{
  height: 100%;
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.shop-sells-count,.shop-goods-count{
  font-size: 1.25rem;
  margin-top: 0.5rem;
}
.shop-sales-title,.shop-goods-title{
  font-size: 0.625rem;
  margin-top: 0.3125rem;
}
.shopbro{
  width: 0.125rem;
  height: 3.125rem;
  margin-top: 1rem;
  background-color: rgb(201, 201, 201);
}
.shop-right{
  height: 4.375rem;
  font-size: 0.75rem;
}
.shop-right table{
  width: 100%;
  margin-left: 1.25rem;
  border-collapse:separate;
  border-spacing:0.625rem 0.625rem;
}
.shop-right tr{
  text-align: center;
}
.shop-scroe td{
  border-radius: 0.125rem;
}
.right-score{
  color:green;
}
.right-isBetter {
  color: #fff;
  background-color: green;
}
.score-better{
  color: var(--color-high-text);
}
.better-more{
  background-color: var(--color-high-text);
}
.shop-bottom{
  width: 100%;
  text-align: center;
}
.enter-bottom{
  width: 50%;
  height: 1.5rem;
  text-align: center;
  background-color: #F4F3FB;
  margin-left: 25%;
  border-radius: 0.125rem;
  margin-top: 0.9375rem;
  margin-bottom: 0.9375rem;
  font-size: 0.875rem;
  padding-top: 0.3125rem;
}

</style>